
package com.yuantu.judiciary.dao;

import com.yuantu.judiciary.model.domain.MonitorEntityDO;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;

import java.util.Date;


/**
 * 账号数据库操作
 *
 * @author syw
 * @since 2023-08-03
 **/
public interface IMonitorEntityDao extends JpaRepository<MonitorEntityDO, Long> {


    MonitorEntityDO findInfoByMonitorContentAndMonitorType(@Param("monitorContent") String monitorContent, @Param("monitorType") Integer monitorType);

    @Modifying
    @Query(nativeQuery = true, value = "delete from monitor_entity where id = :id ")
    void removeInfoById(Long id);


    @Query(nativeQuery = true, value = "select * from monitor_entity where monitor_content = :monitorContent " +
            "and date_format(create_time, '%Y%m%d') = date_format(:createTime, '%Y%m%d') ")
    MonitorEntityDO findInfoByMonitorContentAndCreateTime(@Param("monitorContent") String monitorContent, @Param("createTime") Date createTime);
}
